Skip to content

MEA-133: Review: Show pending check-offs and adds, and ignore repeat taps - #204

Merged
bboyer4806 merged 1 commit into
mainfrom
claude/mea-133
Nov 28, 2026
Merged

bboyer4806 merged 1 commit into
mainfrom
claude/mea-133

Conversation

@bboyer4806

Copy link
Copy Markdown
Owner

Implements MEA-133.

What changed

On a slow connection, checking off or adding a grocery line now shows progress right away, and a repeat tap while it's on its way does nothing.

  • src/routes/(app)/groceries/+page.svelte
    • Changes on their way: a SvelteSet, sending, holds the page's changes in flight, keyed by what sent them: 'add' (the add bar and its duplicate or archived question), a store group's key (Mark all), 'sheet' (a line's edit sheet), a line's id (checking it off, from its circle or "Where did you get it?") and undo-<id> (undoing that). oneAtATime() cancels a form sent again while its key is there, and clears the key once the result is handled. send(), submitPrompt and lineSubmit() all go through it, so each of the page's forms ignores a repeat submit until its result arrives.
    • Circle: it fills as soon as it's tapped, and the row's circle and line buttons are disabled (the app's disabled style dims them) until the answer comes. Undoing empties the circle the same way. A check-off and an undo have separate keys, so a row always shows the direction of its own change, even when another change's refresh moves the line first.
    • "Where did you get it?": picking a store disables the stores, and fills the row's circle behind the sheet, until the check-off is answered. Its form reads the line as it's sent (submitPicker), since the same form stays on the page from one line to the next and use:enhance doesn't pick up a new submit function.
    • Add reads "Adding…" while an add is on its way. It stays enabled, so a tap on it, or Enter, is just ignored, and focus stays where it was.
    • "Already received" after a repeat tap: checkOff() remembers the lines the page has sent a check-off for. When checking one of them off again finds it already received, the earlier tap went through but its answer was lost, so it counts as done: no message, the list refreshes, and "Where did you get it?" closes. A line's first check-off that finds it received, as when someone else checked it off first, still says "This line was already received".
  • src/lib/groceries.ts (new): ALREADY_RECEIVED, shared by the page and the data layer (needs.ts throws it from markReceived and markGotFewer), as src/lib/menu.ts shares NO_DISHES.
  • docs/design.md: 7, Grocery list (the circle, "Where did you get it?", Add and repeat taps) and 6.11 (a repeat check-off after no answer).
  • No schema change, no migration, and no change to any action or its answers.

Tests

In tests/e2e/groceries.e2e.ts, slowAction() holds an action's requests, as a slow connection would, until the test answers them, and counts them.

  • Circle: while Bread's check-off is held, a double tap sends one request; the circle shows ✓, Bread's circle and line buttons are disabled, and nothing moves to Received today. Once answered, Bread is under Received today with no message and Milk is untouched. A double-tapped undo empties the circle and also sends one request.
  • "Where did you get it?": a double-tapped store sends one check-off, and both stores stay disabled, with the row's circle filled, until it's answered.
  • Add: while held, Add reads "Adding…", and a tap on it and Enter in Unit send nothing: one request, no question, and one line of 1 bag.
  • Lost answer: the first check-off reaches Meals but its answer is dropped, so the row says "Couldn't reach Meals…" and the line is received in the database. The second tap counts as done, with no message.
  • The existing test where someone else checked the line off first still expects "This line was already received".

I checked that all four new tests fail against main's grocery page.

Assumptions (please check)

  1. Every form on the grocery page ignores a repeat submit, not only the circles and Add: also the question about an item already on the list, Mark all and a line's edit sheet. The plan says "ignore repeat submits of a form", and they all share the page's three submit helpers. Only the circles, "Where did you get it?" and Add change how they look; the others just ignore the repeat.
  2. Undo works like a check-off: its circle empties right away and the row waits, since it's the same circle with the same double-tap problem (a second undo either errors or undoes the line that moved under the finger).
  3. Add isn't disabled, unlike Feedback's "Sending…". A focused button that becomes disabled loses focus to the page, which would also defeat MEA-135's "refocus only if the add bar still had focus".
  4. "After a repeat tap" means after any earlier check-off of that line from the page, not only one that got no answer. With repeat taps ignored while pending, a lost answer is in practice the only way to get there; the other, undoing and then someone else checking it off before the next tap, also ends with the line received, as the tap asked.
  5. "Where did you get it?" disables its stores while its check-off is on its way, as part of "that row's buttons", so the sheet shows progress too.

Checks

Node 26.13.1, at 792f10f, on the current main (81b9702):

  • npm run db:generate -- --name ci-schema-check: "No schema changes, nothing to migrate", and drizzle/ unchanged.
  • npm run check: 0 errors, 0 warnings.
  • npm test: 78 files, 1272 tests passed.
  • npm run test:e2e against the Docker image built from this branch (E2E_IMAGE), as CI runs it: 321 passed. This container has Chromium build 1243 while Playwright 1.64.1 expects 1248, so I pointed PW_CHROMIUM_PATH at its headless shell, which is what Playwright runs headless; CI installs the right one. (Pointed at the full Chromium instead, two Menu swipe tests, MEA-249, fail here on the finger's offset. They pass with the headless shell.)
  • To build the image here, I used a scratch copy of the Dockerfile that mounts this sandbox's proxy certificate as a build secret for the build stage's npm ci only, so it could reach the registry. Nothing else differs, and the run stage is unchanged.
  • I looked at the list on a phone, in the light and dark themes, with a check-off, an undo and an add held: the pending circle reads as checked but dimmed, the undone one as empty and dimmed with the line still struck through, and "Adding…" at full strength.

Generated by Claude Code

On a slow connection the grocery list showed nothing until a change was
answered, so people tapped again: the second check-off said "This line
was already received" or checked off the line that moved under the
finger, and a second Add asked about the line the first one added, so
Update doubled it.

- +page.svelte: a SvelteSet, `sending`, holds the page's changes on
  their way, by what sent them: 'add', a store group's key, 'sheet', a
  line's id for a check-off and `undo-<id>` for an undo. oneAtATime()
  cancels a form sent again while its key is there; send(),
  submitPrompt and lineSubmit() all go through it.
- A row's circle fills as soon as it's tapped, or empties for an undo,
  and the row's buttons are disabled until the answer comes. Picking a
  store under "Where did you get it?" disables the stores the same way.
  Add reads "Adding…" and stays enabled, so focus stays where it was.
- checkOff() remembers the lines the page has sent a check-off for.
  When checking one off again finds it already received, an earlier tap
  went through without its answer arriving, so it counts as done: no
  message, and the list refreshes. A first check-off that finds its
  line received still says "This line was already received".
- src/lib/groceries.ts: ALREADY_RECEIVED, shared by the page and the
  data layer, which throws it.
- design.md 7, Grocery list, and 6.11. No schema change or migration.
- Browser tests: the circle and its row while a check-off and an undo
  are held, a double tap sending one request; the stores disabled under
  "Where did you get it?"; Add reading "Adding…", with a second tap and
  Enter sending nothing; and a second tap after a lost answer counting
  as done.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XSAcsAw5bkEzyVaBoAn3Sj
@bboyer4806
bboyer4806 merged commit cd67fb1 into main Nov 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants